import http from "@/utils/http";

export default {
    getAll: (): Promise<Array<Vm.Role>> => http<null, Array<Vm.Role>>({ url: "/role/all" }),
    add: (data: HttpPayload.Role): Promise<number> => http<HttpPayload.Role, number>({ url: "role/add", method: "post", data: data }),
    update: (data: HttpPayload.Role): Promise<null> => http<HttpPayload.Role>({ url: "role/update", method: "post", data: data }),
    remove: (id: number): Promise<null> => http({ url: "/role/remove/" + id, method: "post" }),
    roleFuncConfig: (data: HttpPayload.RoleFunc): Promise<null> => http<HttpPayload.RoleFunc>({ url: "/role_function/config", method: "post", data }),
    getRoleFuncs:(role_id:number):Promise<Array<Vm.Func>> => http<null,Array<Vm.Func>>({url:"/role_function/list/"+role_id})
}